package com.htgd.gardenexpo.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.htgd.gardenexpo.entity.GeConFood;
import com.htgd.gardenexpo.entity.GeConTraffic;
import com.htgd.gardenexpo.dao.GeConTrafficDao;
import com.htgd.gardenexpo.page.TrafficQuery;
import com.htgd.gardenexpo.service.GeConTrafficService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 美食表 服务实现类
 * </p>
 *
 * @author author
 * @since 2024-04-15
 */
@Service
public class GeConTrafficServiceImpl extends ServiceImpl<GeConTrafficDao, GeConTraffic> implements GeConTrafficService {

    @Override
    public Page<GeConTraffic> querylist(TrafficQuery trafficQuery) {
        Page<GeConTraffic> p = Page.of(trafficQuery.getPageNum(), trafficQuery.getPageSize());
        Page<GeConTraffic> page = lambdaQuery().page(p);
        page.setTotal(page.getRecords().size());
        return page;
    }

    @Override
    public void addHit(String id) {
        lambdaUpdate().setSql("hit = hit +1").eq(GeConTraffic::getId,id).update();
    }
}
